  
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
    <resource:richTextEditor type="full" />
    <resource:autoComplete skin="default"/>     
    <g:javascript library="selectOptions" />
    <title>Edit your profile</title>
  </head>
  <body>
    <div class="nav">
      %{--<span class="menuButton"><a href="${createLinkTo(dir:'')}">Home</a></span>--}%
      %{--<span class="menuButton"><g:link action="list">Person List</g:link></span>--}%
      %{--<span class="menuButton"><g:link action="create">New Person</g:link></span>--}%
    </div>
    <div class="body">
      <h1>Edit Person</h1>
      <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
      </g:if>
      <g:hasErrors bean="${person}">
        <div class="errors">
          <g:renderErrors bean="${person}" as="list" />
        </div>
      </g:hasErrors>
      
      <div class="prop">
	    <span class="name">Id:</span>
	    <span class="value">${person?.id}</span>
      </div>
                 
      <g:form controller="user" method="post" >
        <input type="hidden" name="id" value="${person?.id}" />
        <div class="dialog">
          <table>
            <tbody> 
                       
		      %{--<tr class='prop'>--}%
			    %{--<td valign='top' class='name'>--}%
			      %{--<label for='username'>Login Name:</label>--}%
			    %{--</td>--}%
				%{--<td valign='top' --}%
				    %{--class='value ${hasErrors(bean:person,field:'username','errors')}'>--}%
				  %{--<input type="text" name='username' --}%
				         %{--value="${person?.username?.encodeAsHTML()}"/>--}%
				%{--</td>--}%
			  %{--</tr>--}%
                       
			  <tr class='prop'>
			    <td valign='top' class='name'>
			      <label for='userRealName'>Full Name:</label>
			    </td>
				<td valign='top' 
				    class='value ${hasErrors(bean:person,field:'userRealName','errors')}'>
				  <input type="text" name='userRealName' 
				         value="${person?.userRealName?.encodeAsHTML()}"/>
				</td>
			  </tr>
                       
			  %{--<tr class='prop'>--}%
			    %{--<td valign='top' class='name'>--}%
			      %{--<label for='passwd'>Password:</label>--}%
			    %{--</td>--}%
				%{--<td valign='top' --}%
				    %{--class='value ${hasErrors(bean:person,field:'passwd','errors')}'>--}%
				  %{--<input type="password" name='passwd' --}%
				         %{--value="${person?.passwd?.encodeAsHTML()}"/>--}%
				%{--</td>--}%
			  %{--</tr>--}%
                       
			  %{--<tr class='prop'>--}%
				%{--<td valign='top' class='name'>--}%
				  %{--<label for='enabled'>Enabled:</label>--}%
				%{--</td>--}%
				%{--<td valign='top' --}%
				    %{--class='value ${hasErrors(bean:person,field:'enabled','errors')}'>--}%
				  %{--<g:checkBox name='enabled' value="${person?.enabled}" ></g:checkBox>--}%
				%{--</td>--}%
			  %{--</tr>--}%
                       
			  <tr class='prop'>
			    <td valign='top' class='name'>
			      <label for='description'>Short description:</label>
			    </td>
				<td valign='top' 
				    class='value ${hasErrors(bean:person,field:'description','errors')}'>
                    <input type="text" size="40" width="30" name="description" value="${person?.description?.encodeAsHTML()}"/>
                  %{--<textArea cols="20" rows="1"  name='description'> ${person?.description?.encodeAsHTML()}</textArea>--}%
				</td>
			  </tr>
                       
			  <tr class='prop'>
			    <td valign='top' class='name'>
			      <label for='email'>Email:</label>
			    </td>
				<td valign='top' 
				    class='value ${hasErrors(bean:person,field:'email','errors')}'>
				  <input type="text" name='email' size="40" maxlength="50"
				         value="${person?.email?.encodeAsHTML()}"/>
				</td>
			  </tr>
                       
			  <tr class='prop'>
			    <td valign='top' class='name'>
			      <label for='email_show'>Show Email:</label>
			    </td>
				<td valign='top' 
				    class='value ${hasErrors(bean:person,field:'email_show','errors')}'>
				  <g:checkBox name='email_show' value="${person?.email_show}" >
				  </g:checkBox>
				</td>
			  </tr>
                  
			  %{--<tr class='prop'>--}%
				%{--<td valign='top' class='name'>--}%
				  %{--<label for='authorities'>Roles:</label>--}%
				%{--</td>--}%
	    		%{--<td valign='top' --}%
	    			%{--class='value ${hasErrors(bean:person,field:'authorities','errors')}'>--}%
				  %{--<ul>--}%


					%{--<g:set var="list" value="[]"/>--}%
					%{--<g:each var='b' in="${authorityList.authority}">--}%
    				  %{--<g:each var='a' in='${person?.authorities?}'>--}%
    			        %{--<g:if test="${b==~ a.authority}">--}%
    					  %{--<%if(!list.contains(b)){list.add(b);%>--}%
    					    %{--<li>${a.authority?.substring(5)?.toLowerCase()?.encodeAsHTML()}--}%
    						  %{--<g:checkBox name='${a.authority}' value="${true}" ></g:checkBox>--}%
    						%{--</li>--}%
    					  %{--<%}%>--}%
    					%{--</g:if>--}%
    				  %{--</g:each>--}%
    				  %{--<%if(!list.contains(b)){list.add(b);%>--}%
    				    %{--<li>${b.substring(5)?.toLowerCase()?.encodeAsHTML()}--}%
    					  %{--<g:checkBox name='${b}' value="${false}" ></g:checkBox>--}%
    					%{--</li>--}%
    				  %{--<%}%>--}%
    				%{--</g:each>--}%
				  %{--</ul>--}%
				%{--</td>--}%
			  %{--</tr>--}%
                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="title">Your work title:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean:person?.profile,field:'title','errors')}">
                        <input type="text" size="60" id="title" name="title" value="${fieldValue(bean:person?.profile,field:'title')}"/>
                    </td>
                </tr>
                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="title">Your expertise field:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean:person?.profile,field:'expertise','errors')}">
                        <g:each var="e" in="${person?.profile?.expertise}">
                          <g:link controller="expertise" action="show" id="${e.id}">${e?.title}</g:link>;
                      </g:each>
                        %{--${person?.profile?.expertise?.size()} :${person?.profile?.expertise}--}%
                        <g:each status="i" var="e" in="${person?.profile?.expertise}">
                            <richui:autoComplete name='${"expertise"+i}' value="${e?.title}" action="${createLinkTo('dir': 'expertise/searchExpertise')}" />
                          %{--<g:link controller="expertise" action="show" id="${e.id}">${e?.title}</g:link>--}%
                      </g:each>
                       <g:if test="${person?.profile?.expertise?.size()<3}">
                            <richui:autoComplete name='${"expertise"+person?.profile?.expertise?.size()}' value="" action="${createLinkTo('dir': 'expertise/searchExpertise')}" />
                       </g:if>
                    </td>
                </tr>
                <tr>
                    <td valign="top" class="name">
                        <label for="title">Your proffession's field:</label>
                    </td>
                    <td>
                        <select name="categoryList" size="5">
                            <g:each in="${categoryList}" status="i" var="cat">
                                <option value="${cat?.id}">${cat?.title?.encodeAsHTML()}</option>
                            </g:each>

                        </select>

                        <label>Add new category here:</label>
                        <input type="text" name="newCategory" size="20" value=""/>
                        %{--<input type="button" name="right" value="&gt;&gt;"--}%
                                %{--ONCLICK="moveSelectedOptions(this.form['categoryList'],this.form['category'],false);return false;"/>--}%
                        %{--<a href="#" ONCLICK="moveSelectedOptions(this.form['categoryList'],this.form['category'])">ADD</a> <!--,false);return false; -->--}%
                        %{--<select type="category" size="5">--}%

                        %{--</select>--}%
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="resume">Resume:</label>
                    </td>
                    <td valign="top" class="value ${hasErrors(bean:person?.profile,field:'resume','errors')}">
                        %{--<textarea rows="5" cols="40" name="resume">${person?.profile?.resume?.encodeAsHTML()}</textarea>--}%
                        <richui:richTextEditor name="resume"  width="500" height="380" value="${person?.profile?.resume}"/>
                    </td>
                </tr>


            </tbody>
          </table>
        </div>

        <div class="buttons">
          <span class="button"><g:actionSubmit value="Update" /></span>
          <span class="button"><g:actionSubmit value="Delete" /></span>
        </div>
        
      </g:form>
      
    </div>
  </body>
</html>
